package Helper;

import entity.Showing;
import java.util.Calendar;
import java.util.Comparator;

/**
 * @Written by T12 (IS3102 AY2011/12)
 */
public class CalendarComparator implements Comparator{
    public int compare(Object x, Object y){
        Showing x1 = (Showing) x;
        Showing y1 = (Showing) y;
        Calendar timex = x1.getShowDate();
        Calendar timey = y1.getShowDate();
        if (timex.before(timey)) {
            return -1;
        }
        if (timex.after(timey)) {
            return 1;
        }
        return 0;
    }
    
    public static final Comparator INSTANCE = new CalendarComparator();
}
